#include "pch.h"

#include "BasicLoader.h"
#include "ShaderPair.h"

using namespace D2D1;

static BasicLoader^ shaderBasicLoader = nullptr;

ShaderPair::ShaderPair(_In_ ID3D11Device* Device, const wchar_t VertexShaderFile[], const wchar_t PixelShaderFile[])
{
	if (shaderBasicLoader == nullptr)
	{
		shaderBasicLoader = ref new BasicLoader(Device);
	}

	// load the vertex shader and retrieve the input layout.
	shaderBasicLoader->LoadShader(
        ref new Platform::String(VertexShaderFile),
        nullptr,
        0,
        &VertexShader,
        &InputLayout
        );

	// load the pixel shader
	shaderBasicLoader->LoadShader(
        ref new Platform::String(PixelShaderFile),
        &PixelShader
        );
}

ShaderPair::ShaderPair(
				ID3D11VertexShader*          VertexShader, 
				ID3D11InputLayout*           InputLayout,

				ID3D11PixelShader*           PixelShader)
{
	this->VertexShader = VertexShader;
	this->InputLayout = InputLayout;
	this-> PixelShader = PixelShader;
}

